﻿<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>

    <link href="/CSS/bootstrap3.3.5/css/bootstrap.css" rel="stylesheet">
    <link href="/CSS/font-awesome-4.3.0/css/font-awesome.min.css" rel="stylesheet">
    <link href="/CSS/Base/BaseClass.css" rel="stylesheet" type="text/css" />
      

    <script src="/Scripts/jquery-1.11.2.min.js"></script>
    <script src="/Scripts/jquery-migrate-1.1.0.min.js"></script>
    <script src="/JqueryPlug/layer/layer/layer.js"></script>
    <script src="/Scripts/avalon.min.js"></script>
    <script src="/CSS/bootstrap3.3.5/js/bootstrap.js"></script>
    <script src="/Scripts/SZHLCommon.js"></script>
    <style>
        .pCard {
            min-width: 80px;
            text-align: center;
            margin: 0 5px 5px 5px;
        }
    </style>

    <script type="text/javascript">
        $.ajaxSetup({
            async: false
        });
        var rolecode = ComFunJS.getQueryString("rolecode");
        var model = avalon.define({
            $id: "RoleAdd", 
            RoleUser:"",
            RoleData: { "RoleName": "", "RoleDec": "", "IsUse": "Y", "IsSysRole": "N", "roleType": "业务角色" }, 
            RoleEdit: function () {
                var modelValue = JSON.stringify(model.RoleData.$model);
                $.post("/API/SZHLAPI.ashx", { Action: "EditRole", P1: modelValue, P2: model.RoleUser },
                function (result) {
                    if ($.trim(result.ErrorMsg) != "") {
                        ComFunJS.winwarning(result.ErrorMsg);
                    } else {
                        ComFunJS.winsuccess("添加成功");
                    }
                });
            },
            SetFrameHeight: function (framename) {
                var oFrm = document.getElementById(framename);
                oFrm.onload = oFrm.onreadystatechange = function () {
                    if (this.readyState && this.readyState != 'complete') return;
                    else {
                        var mainheight = $("#dvContent").height() - 45;
                        $("#" + framename).height(mainheight);
                        $("#mastmenu").height(mainheight);
                        $(window.frames[framename].document).find(".maindiv").css({ height: mainheight + "px", overflow: "auto" });
                    }
                }
            }
        });
        avalon.ready(function () {
            if (rolecode != null) {
                //获取主要菜单
                $.getJSON('/API/SZHLAPI.ashx?Action=GETROLEBYCODE', { "P1": rolecode }, function (resultData) {
                    model.RoleData = resultData.Result;
                    model.RoleUser = resultData.Result1;
                })
            }
            ComFunJS.initForm();
        })

    </script>
</head>
<body ms-controller="RoleAdd" >
    <div class="container-fluid maindiv" style="margin: 50px 20px 50px 20px">
        <div id="addForm" class="form-horizontal">
            <div class="form-group">
                <label for="branchName" class="col-xs-3 control-label text-right">角色名称</label>
                <div class="col-xs-7">
                    <input type="text" class="form-control" ms-duplex="RoleData.RoleName" id="branchName" placeholder="请输入角色名称" />
                </div>
            </div>

            <div class="form-group">
                <label for="branchShort" class="col-xs-3 control-label text-right">角色类型</label>
                <div class="col-xs-7">
                    <select id="roleType" class="form-control" ms-duplex="RoleData.roleType">
                        <option value="业务角色">业务角色</option>
                        <option value="职务角色">职务角色</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="branchShort" class="col-xs-3 control-label text-right">是否可用</label>
                <div class="col-xs-7">
                    <select id="isUse" class="form-control" ms-duplex="RoleData.IsUse">
                        <option value="Y">是</option>
                        <option value="N">否</option>
                    </select>
                </div>
            </div>
            <div class="form-group hide">
                <label for="branchShort" class="col-xs-3 control-label text-right ">是否系统角色</label>
                <div class="col-xs-7">
                    <select id="isUse" class="form-control" ms-duplex="RoleData.IsSysRole">
                        <option value="Y" ms-attr-selected="RoleData.IsSysRole=='Y'?'selected':''">是</option>
                        <option value="N" ms-attr-selected="RoleData.IsSysRole=='N'?'selected':''">否</option>
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label for="branchDesc" class="col-xs-3 control-label text-right">角色描述</label>
                <div class="col-xs-7">
                    <textarea class="form-control" ms-duplex="RoleData.RoleDec" id="branchDesc" placeholder="请输入角色描述"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-xs-3 control-label">角色人员</label>
                <div class="col-xs-7">
                    <input type="text" value="" class="span2   form-control  szhl_getPeoples" ms-duplex="RoleUser" id="qygg2" />
                </div>
            </div>
            <div class="form-group  ">
                <div class="col-xs-12 text-center ">
                    <input type="button" id="btnAdd" value="保存" ms-click="RoleEdit()" class="btn btn-lg btn-success" />
                </div>
            </div>
        </div>
    </div>
</body>
</html>
